/*
 * @Description:
 * @version:
 * @Author: m
 * @LastEditors: m
 */
import Cookies from "js-cookie";

const TokenKey = "user";

export function getToken() {
  if (
    Cookies.get(TokenKey) == undefined ||
    Cookies.get(TokenKey) == "undefined" ||
    Cookies.get(TokenKey) == "" ||
    Cookies.get(TokenKey) == null
  ) {
    return "";
  }
  return JSON.parse(Cookies.get(TokenKey));
}

export function setToken(token) {
  return Cookies.set(TokenKey, JSON.stringify(token));
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}
